package com.fgr.mapper;

import com.fgr.beans.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {
    @Select("select * from an_user")
    public List<User> selectAllUser();

    @Select("select * from an_user where username=#{username} and password=#{password}")
    public User selectUser(User user);

    @Select("select * from an_user where username=#{username}")
    public User selectUserName(User user);

    @Insert("insert into an_user(username,password) value(#{username},#{password})")
    public Integer insertUser(User user);

    @Delete("delete from an_user where u_id=#{uid}")
    public Integer deleteUserById(Integer uid);

    @Select("select * from an_user where u_id=#{uid}")
    public User findUserById(Integer id);

    @Update("update an_user set username=#{username},password=#{password} where u_id=#{uId}")
    public Integer UpdateUser(User user);


    }
